package com.common.base.app.fragment

import com.common.base.R
import com.common.base.app.extras.no
import com.common.base.app.viewmodel.ListViewModel
import com.common.base.databinding.BaseRecylerBinding
import com.common.base.widget.PlaceholderView

/**
 * 列表基类
 */
abstract class BaseRecyclerFragment<VM : ListViewModel<K>, K> :
    BaseRecyclerVMFragment<BaseRecylerBinding, VM, K>() {

    override fun getViewBinding() = BaseRecylerBinding.inflate(layoutInflater)

    //占位控件
    override fun getPlaceholderView(): PlaceholderView? = mViewBinding.mPlaceholderView

    override fun getHeadLayout() = mViewBinding.headLayout
    override fun getContentLayout() = mViewBinding.contentLayout

    override fun initEvents() {
        setErrorRetryListener {
            autoRefresh()
        }
    }

    override fun getIRecyclerView() = mViewBinding.mtRecyclerView
}